package com.fahai.web.service.impl;

import com.fahai.common.PageVo;
import com.fahai.web.dao.DeviceInfoDao;
import com.fahai.web.entity.BusPayFlowno;
import com.fahai.web.entity.DeviceInfo;
import com.fahai.web.service.DeviceService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceServiceImpl implements DeviceService {
    @Autowired
    DeviceInfoDao deviceInfoDao;
    @Override
    public PageVo findList(DeviceInfo deviceInfo, PageVo pageVo) {
        Page<DeviceInfo> page = PageHelper.startPage(pageVo.getPageNum(), pageVo.getPageSize());
        List<DeviceInfo> vos=deviceInfoDao.queryDeviceInfo(deviceInfo);
        pageVo.setResult(vos);
        return pageVo;
    }


    @Override
    public void insert(DeviceInfo deviceInfo) {
    deviceInfoDao.insert(deviceInfo);
    }

    @Override
    public void update(DeviceInfo deviceInfo) {
    deviceInfoDao.updateByPrimaryKey(deviceInfo);
    }

    @Override
    public int getCount(DeviceInfo deviceInfo, PageVo pageVo) {
        return deviceInfoDao.countDeviceInfo(deviceInfo);
    }


    @Override
    public DeviceInfo getDeviceInfoByDeviceNum(DeviceInfo deviceInfo) {
        return deviceInfoDao.selectByDeviceNum( deviceInfo);
    }
}
